package com.zhangxiaofanfan.hotcode.second;

import java.util.HashMap;
import java.util.Map;

/**
 * TODO
 *
 * @author zhangxiaofanfan
 * @date 2024-06-26 20:33:33
 */
public class HotCode049 {
    public static void main(String[] args) {

    }

    private Map<TreeNode, Integer> map = new HashMap<>();
    TreeNode result = null;
    public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
        return null;
    }

    public int bfs(TreeNode node, TreeNode p, TreeNode q) {
        if (node == null || result != null) {
            return 0;
        }
        int hasNode = 0;
        if (node == p || node == q) {
            hasNode++;
        }
        bfs(node.left, p, q);
        bfs(node.right, p, q);
        return hasNode;
    }

    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode() {
        }

        TreeNode(int val) {
            this.val = val;
        }

        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }
}
